package com.biz.primus.search.vo.search;

import com.biz.primus.base.constant.Constant;
import com.biz.primus.base.enums.search.ProductSearchSort;
import com.biz.primus.common.utils.CopyUtils;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * 快喝品牌商城 商品搜索条件 Vo
 *
 * @author david-liu
 * @date 2017年01月07日
 * @reviewer
 */
public class SearchTypeAProductConditionVo implements Serializable {

    private static final long serialVersionUID = -2654803892537897300L;

    /**
     * 搜索关键字
     */
    private String keyword;

    /**
     * 搜索字段
     */
    private List<SearchFieldVo> fields;

    /**
     * 区域 ID
     */
    private Long geoId;

    /**
     * 商家 ID
     */
    private Long vendorId;

    /**
     * 分类 ID
     */
    private Long categoryId;

    /**
     * 商品搜索排序(默认采用综合排序)
     *
     * @see ProductSearchSort
     */
    private ProductSearchSort sort = ProductSearchSort.DEFAULT_SORT;

    /**
     * 页数(默认: 0)
     *
     * @see Constant
     */
    private Integer page = Constant.DEFAULT_PAGE;

    /**
     * 页大小(默认: 50)
     *
     * @see Constant
     */
    private Integer pageSize = Constant.DEFAULT_PAGE_SIZE;

    /**
     * 用户会员等级(默认: 1)
     *
     * @see Constant
     */
    private Integer userLevel = Constant.DEFAULT_USER_LEVEL;

    /**
     * 当前定位纬度
     */
    private BigDecimal latitude;

    /**
     * 当前定位经度
     */

    private BigDecimal longitude;

    private Long  brandId;

    public Long getBrandId() {
        return brandId;
    }

    public void setBrandId(Long brandId) {
        this.brandId = brandId;
    }

    public String getKeyword() {
        return keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }

    public List<SearchFieldVo> getFields() {
        return fields;
    }

    public void setFields(List<SearchFieldVo> fields) {
        this.fields = fields;
    }

    public Long getGeoId() {
        return geoId;
    }

    public void setGeoId(Long geoId) {
        this.geoId = geoId;
    }

    public Long getVendorId() {
        return vendorId;
    }

    public void setVendorId(Long vendorId) {
        this.vendorId = vendorId;
    }

    public Long getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    public ProductSearchSort getSort() {
        return sort;
    }

    public void setSort(ProductSearchSort sort) {
        this.sort = sort;
    }

    public Integer getPage() {
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getUserLevel() {
        return userLevel;
    }

    public void setUserLevel(Integer userLevel) {
        this.userLevel = userLevel;
    }

    public BigDecimal getLatitude() {
        return latitude;
    }

    public void setLatitude(BigDecimal latitude) {
        this.latitude = latitude;
    }

    public BigDecimal getLongitude() {
        return longitude;
    }

    public void setLongitude(BigDecimal longitude) {
        this.longitude = longitude;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }

    public SearchProductRequestVo buildSearchProductConditionVo() {
        SearchProductRequestVo searchProductRequestVo = new SearchProductRequestVo();
        CopyUtils.copyProperties(this, searchProductRequestVo);
        return searchProductRequestVo;
    }

    public static void main(String[] args) {
        SearchTypeAProductConditionVo resp = new SearchTypeAProductConditionVo();
        resp.setCategoryId(123L);
        SearchFieldVo searchFieldVo = new SearchFieldVo();
        searchFieldVo.setField("brand");
        searchFieldVo.setValue("345");
        resp.setFields(Lists.newArrayList(searchFieldVo));
        resp.setSort(ProductSearchSort.DEFAULT_SORT);
        SearchProductRequestVo searchProductRequestVo = resp.buildSearchProductConditionVo();
        System.out.println(searchFieldVo);
    }
}
